package com.xiangxiao.rpan.data.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xiangxiao.rpan.data.constant.GlobalConsts;
import com.xiangxiao.rpan.data.enums.MessageTypeEnum;
import lombok.Data;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @auther xiangxiao
 * @email 573768011@qq.com
 * @data 2024/5/9 11:35
 */
@Getter
@Setter
public class FileDownLoadAlarm extends BaseAlarm implements Serializable {
  private static final long serialVersionUID = -1279254421313326195L;

  private Integer alarmType;
  /**
   * 文件id
   * */
  private String fileId;

  /***
   * 文件名
   */
  private String name;

  /***
   * 下载后的保持路径
   */
  private String savePath;

  /***
   * 文件后缀名
   */
  private String fileExtension;

  /***
   * 文件大小(单位:byte)
   */
  private Float size;

  /**
   *目标类型(文件、文件夹)
   * */
  private Integer type;

  /**
   * 下载开始时间
   * */
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private Date startTime;

  /**
   * 下载完成时间
   * */
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private Date finishTime;

  /**
   * 下载者
   * */
  private String operator;

  @JsonIgnore
  @JSONField(serialize = false)
  public MessageTypeEnum getMessageType() {
    return MessageTypeEnum.getByCode(alarmType);
  }

  @Override
  public Integer getType() {
    return GlobalConsts.FILE_TYPE;
  }

  @Override
  public Integer getId() {
    return super.getId();
  }

  @Override
  public Date getTime() {
    return super.getTime();
  }
}
